package com.activity;

import android.os.Bundle;
import android.widget.Button;

import com.util.R;
import com.util.ToastUtil;

import butterknife.BindColor;
import butterknife.BindDimen;
import butterknife.BindString;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/3/30.
 */
public class ButterKnifeActivity extends BaseActivity {
    @BindString(R.string.app_name)
    String app_name;
    @BindColor(android.R.color.holo_blue_light)
    int blue; // int or ColorStateList field
    @BindDimen(android.R.dimen.app_icon_size)
    float spacer;

    //...
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_butter_knife);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.bt_1, R.id.bt_2, R.id.bt_3})
    public void onButtonClick(Button bt) {
        switch (bt.getId()) {
            case R.id.bt_1:
                ToastUtil.showBottomToast(app_name);
                break;
            case R.id.bt_2:
                bt.setTextColor(blue);
                break;
            case R.id.bt_3:
                ToastUtil.showBottomToast(spacer);
                break;
        }
    }
}
